package CtrLayer;

import java.util.ArrayList;

import ModelLayer.*;
import DBLayer.*;

public class CtrBuilding {
	private IFDBBuilding dbBuilding;

	public CtrBuilding() {
		dbBuilding = DBBuilding.getInstance();
	}

	public ArrayList<Building> getAll() {
		return dbBuilding.getAll();
	}
	
	public int update(Building build){
		return dbBuilding.update(build);
	}
	
	public ArrayList<Building> getAll_where(String wClause){
		return dbBuilding.getAll_where(wClause);
	}
	
	public ArrayList<Building> searchRandom(String searchF) {
		return dbBuilding.searchRandom(searchF);
	}

	public Building getBuildingById(int buildingNr) {
		return dbBuilding.getBuildingById(buildingNr);
	}
	
	public Building getBuildingByName(String name) {
		return dbBuilding.getBuildingByName(name);
	}

	public int insert(int buidlingNr, String buildingName, String address,String city, String postalcode, String country, String zone,String levyAccountNo, double rateZoneAmount, String companyName) {

		Building building = new Building(buidlingNr, buildingName, address,city, postalcode, country, zone, levyAccountNo, rateZoneAmount, companyName);
		return dbBuilding.insert(building);
	}

	public int update(int buidlingNr, String buildingName, String address,String city, String postalcode, String country, String zone,String levyAccountNo, double rateZoneAmount, String companyName) {

		Building building = new Building(buidlingNr, buildingName, address,city, postalcode, country, zone, levyAccountNo, rateZoneAmount, companyName);
		return dbBuilding.update(building);
	}

	public int delete(int buildingNr) {
		return dbBuilding.delete(buildingNr);
	}

}
